<template>
    <p>用户信息</p>
    <RouterLink to="/Home">返回首页</RouterLink>
</template>

<script setup>
import { onBeforeRouteLeave, RouterLink } from 'vue-router';

onBeforeRouteLeave(() => {
    alert('您正在离开用户页面！')
})
</script>